<template>
	<el-container>
		<el-header style="font-size: 16px;font-weight: 600">代码生成器配置</el-header>
		<el-main class="nopadding">
			<el-main>
				<el-form>
					<el-row :gutter="24">
						<el-col :lg="12">
							<el-form-item label="配置标题" label-width="150px">
								<el-input v-model="form.title" placeholder="后台服务器地址"></el-input>
							</el-form-item>
						</el-col>
						<el-col :lg="12">
							<el-form-item>
								<span style="color: red;"></span>
							</el-form-item>
						</el-col>
					</el-row>
					<el-row :gutter="24">
						<el-col :lg="12">
							<el-form-item label="包路径" label-width="150px">
								<el-input v-model="form.packagePath" placeholder="包路径"></el-input>
							</el-form-item>
						</el-col>
						<el-col :lg="12">
							<el-form-item>
								<span style="color: red;"></span>
							</el-form-item>
						</el-col>
					</el-row>
					<el-row :gutter="24">
						<el-col :lg="12">
							<el-form-item label="业务模块名" label-width="150px">
								<el-input v-model="form.module" placeholder="业务模块名"></el-input>
							</el-form-item>
						</el-col>
						<el-col :lg="12">
							<el-form-item>
								<span style="color: red;"></span>
							</el-form-item>
						</el-col>
					</el-row>
					<el-row :gutter="24">
						<el-col :lg="12">
							<el-form-item label="后台项目路径" label-width="150px">
								<el-input v-model="form.javaPath" placeholder="后台项目路径"></el-input>
							</el-form-item>
						</el-col>
						<el-col :lg="12">
							<el-form-item>
								<span style="color: red;"></span>
							</el-form-item>
						</el-col>
					</el-row>
					<el-row :gutter="24">
						<el-col :lg="12">
							<el-form-item label="前端项目路径" label-width="150px">
								<el-input v-model="form.vuePath" placeholder="前端项目路径"></el-input>
							</el-form-item>
						</el-col>
						<el-col :lg="12">
							<el-form-item>
								<span style="color: red;"></span>
							</el-form-item>
						</el-col>
					</el-row>
					<el-row :gutter="24">
						<el-col :lg="12">
							<el-form-item label="模糊查询字段" label-width="150px">
								<el-input v-model="form.keywordField" placeholder="模糊查询字段"></el-input>
							</el-form-item>
						</el-col>
						<el-col :lg="12">
							<el-form-item>
								<span style="color: red;"></span>
							</el-form-item>
						</el-col>
					</el-row>
					<el-row :gutter="24">
						<el-col :lg="12">
							<el-form-item label="表记录主键" label-width="150px">
								<el-input v-model="form.primaryKey" placeholder="表记录主键"></el-input>
							</el-form-item>
						</el-col>
						<el-col :lg="12">
							<el-form-item>
								<span style="color: red;"></span>
							</el-form-item>
						</el-col>
					</el-row>
					<el-row :gutter="24">
						<el-col :lg="12">
							<el-form-item label="列表记录权限" label-width="150px">
								<el-checkbox-group v-model="form.listRole">
									<el-checkbox-button label="delete">删除</el-checkbox-button>
									<el-checkbox-button label="update">编辑</el-checkbox-button>
									<el-checkbox-button label="details">详情</el-checkbox-button>
								</el-checkbox-group>
							</el-form-item>
						</el-col>
						<el-col :lg="12">
							<el-form-item>
								<span style="color: red;"></span>
							</el-form-item>
						</el-col>
					</el-row>
					<el-row :gutter="24">
						<el-col :lg="12">
							<el-form-item label="批量删除权限" label-width="150px">
								<el-radio-group v-model="form.batchDelete">
									<el-radio-button label="0">禁止</el-radio-button>
									<el-radio-button label="1">启用</el-radio-button>
								</el-radio-group>
							</el-form-item>
						</el-col>
						<el-col :lg="12">
							<el-form-item>
								<span style="color: red;"></span>
							</el-form-item>
						</el-col>
					</el-row>
					<el-row :gutter="24">
						<el-col :lg="12">
							<el-form-item label="创建记录权限" label-width="150px">
								<el-radio-group v-model="form.createRole">
									<el-radio-button label="0">禁止</el-radio-button>
									<el-radio-button label="1">启用</el-radio-button>
								</el-radio-group>
							</el-form-item>
						</el-col>
						<el-col :lg="12">
							<el-form-item>
								<span style="color: red;"></span>
							</el-form-item>
						</el-col>
					</el-row>
<!--					<el-row :gutter="24">
						<el-col :lg="12">
							<el-form-item label="是否加入菜单" label-width="150px">
								<el-radio-group v-model="form.addMenu">
									<el-radio-button label="0">不加入</el-radio-button>
									<el-radio-button label="1">加入</el-radio-button>
								</el-radio-group>
							</el-form-item>
						</el-col>
						<el-col :lg="12">
							<el-form-item>
								<span style="color: red;"></span>
							</el-form-item>
						</el-col>
					</el-row>
					<el-row :gutter="24">
						<el-col :lg="12">
							<el-form-item label="所属菜单" label-width="150px">
								<el-cascader v-model="form.menuId"></el-cascader>
							</el-form-item>
						</el-col>
						<el-col :lg="12">
							<el-form-item>
								<span style="color: red;"></span>
							</el-form-item>
						</el-col>
					</el-row>-->
				</el-form>
			</el-main>
		</el-main>
		<el-footer class="footer">
			<el-button type="primary" @click="setSysGenConfig">设置</el-button>
		</el-footer>
	</el-container>
</template>

<script>
export default {
	name: 'System Gen Config',
	components:{
	},
	data() {
		return {
			form: {
				listRole:[],
			},
		}
	},
	mounted() {
		this.getSysGenConfig();
	},
	methods: {
		async getSysGenConfig() {
			let res = await this.$API.gen.sysGenConfig.getSysGenConfig.get();
			if (res.code == 200) {
				this.form = res.data;
				if(res.data.listRole)
				{
					this.form.listRole = res.data.listRole.split(",");
				}
			} else {
				this.$alert(res.message, "提示", {type: 'error'})
			}
		},
		async setSysGenConfig(){
			let res = await this.$API.gen.sysGenConfig.updateSysGenConfig.post(this.form);
			if (res.code == 200) {
				this.$message.success(res.message)
			} else {
				this.$alert(res.message, "提示", {type: 'error'})
			}
		}
	}
}
</script>

<style scoped>
.footer {
	text-align: center;
}
</style>
